package com.aaa.controller;

import com.aaa.entity.Dept;
import com.aaa.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("system/dept")
public class DeptController {
    @Autowired
    private DeptService deptService;

    @GetMapping("/list")
    public List<Dept> getList() {
        return deptService.findDeptAll();
    }

    @GetMapping("/getByDeptId/{deptId}")
    public Dept getByDeptId(@PathVariable Long deptId) {
        return deptService.getByDeptId(deptId);
    }


    //部门模块调用接口
    @GetMapping("/updNum/{deptId}/{regNumber}")
    public  String getUpdNum(@PathVariable Long deptId, @PathVariable Integer regNumber) {
        return deptService.updNum(deptId,regNumber);
    }
}
